package com.quickstart.common.string;

import java.util.Formatter;
import java.util.UUID;

/**
 * @author:wesley
 */
public class MyStringUtils {


    /**
     * 随机字符串
     *
     * @return
     */
    public static String getNonceStr() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public static String byteToHex(final byte[] hash) {
        Formatter formatter = new Formatter();
        for (byte b : hash) {
            formatter.format("%02x", b);
        }
        String result = formatter.toString();
        formatter.close();
        return result;
    }


}
